#ifndef _IIOOPERATION_H_
#define _IIOOPERATION_H_

#define OP_NULL         0x00
#define OP_WRITETIMEOUT 0x01
#define OP_READTIMEOUT  0x02
#define OP_WRITEERROR   0x04
#define OP_READERROR    0x08
#define OP_OPENERROR    0x10
#define OP_EXCEPTION    0x100
#define OP_EOF          0x200

interface IOperationProc : public IBase
{
    std_method(OnComplete)(IBase* pOperation, crtid cid, crterr err) PURE;
};

// {0470327E-5ACF-40EC-BAED-FE2AAE877B4B}
_DEF_IID(IID_IOperationProc, 0x470327e, 0x5acf, 0x40ec, 0xba, 0xed, 0xfe, 0x2a, 0xae, 0x87, 0x7b, 0x4b);

interface IOperation : public IBase
{
    std_method(BindIBase)(IBase* pBase) PURE;
    std_method(UnBindIBase)() PURE;
    std_method(QueryIBaseIID)(REFIID riid, void** ppv) PURE;
    std_method(BindEvent)(IBase* pEvents) PURE;
    std_method(UnBindEvent)() PURE;
    std_method(SetId)(crtid id) PURE;
    std_method_(crtid, GetId)() PURE;
    std_method(SetResult)(crterr err, buf_len len) PURE;
    std_method(GetResult)(crterr* err, buf_len* len) PURE;
    std_method(SetIoParam)(buf_len pos, buf_len len) PURE;
    std_method(GetIoParam)(buf_len* pos, buf_len* len) PURE;
    std_method(SetExpect)(buf_len len) PURE;
    std_method(GetExpect)(buf_len* len) PURE;
    std_method(SetPos)(buf_len pos) PURE;
    std_method(GetPos)(buf_len* pos) PURE;
    std_method(SetTransfered)(buf_len len) PURE;
    std_method(GetTransfered)(buf_len* len) PURE;
    std_method(Attach)(buf_ptr ptr, buf_len pos, buf_len size) PURE;
    std_method(Alloc)(buf_len size) PURE;
    std_method(GetLen)(buf_len* len) PURE;
    std_method(GetPtr)(buf_ptr* ptr) PURE;
    std_method(GetOperationPtr)(buf_ptr* ptr, buf_len* Len) PURE;
    std_method(ReleasePtr)() PURE;
    std_method(ClearPtr)() PURE;
    std_method(Post)(crtid op, crterr err) PURE;
};

// {FEB12B33-7344-45CD-A375-2495C7BEBD88}
_DEF_IID(IID_IOperation, 0xfeb12b33, 0x7344, 0x45cd, 0xa3, 0x75, 0x24, 0x95, 0xc7, 0xbe, 0xbd, 0x88);

#endif
